import {http} from '../../service/request/index.js'
// 登录
export function login(data){
	/*
	{
		"tPassword": "123",
		"tUsername": "sunquan2"
	}
	*/
    let datas = {
		...data
	}
	let config = {}
	const e = http.post('http://120.26.122.82:8080/user/login',datas)
    return e;
}
// 注册
export function register(data){
	/*
	{
		"tPassword": "123",
		"tUsername": "sunquan2"
	}
	*/
    let datas = {
		...data
	}
	let config = {}
	const e = http.post('http://120.26.122.82:8080/user/register',datas)
    return e;
}
// 文章管理查询
export function articleManageList(){
    let datas = {
		"tUserId":"1897927108349485058" // 写死
	}
	let config = {}
	const e = http.get('http://120.26.122.82:8080/system/article/list',datas)
    return e;
}
// 运动记录查询
export function SportTrack(){
    let datas = {
		"tUserId":"1897927108349485058" // 写死
	}
	let config = {}
	const e = http.get('http://120.26.122.82:8080/system/record/list',datas)
    return e;
}
// 动态-新增
export function postStatusUpdate(data){
	/*
	{
		"tUserId":"1897927108349485058",
		"tContent":"哈哈哈哈 动态",
		"tCreateTime":"1970-01-01 08:00:00",
		"tTitle": "bb",
		"tImage": string of base64
	}
	*/
    let datas = {
		...data,
		"userId":"1897927108349485058"
	}
	let config = {}
	const e = http.post('http://120.26.122.82:8080/system/moments',datas)
    return e;
}
// 动态-查询
export function updateLists(){
    let datas = {
		"tUserId":"1897927108349485058" // 写死
	}
	let config = {}
	const e = http.get('http://120.26.122.82:8080/system/moments/list',datas)
    return e;
}
function getCurrentTime() {
    const date = new Date();
    const year = date.getFullYear();
    const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始，所以要加1
    const day = String(date.getDate()).padStart(2, '0');
    const hours = String(date.getHours()).padStart(2, '0');
    const minutes = String(date.getMinutes()).padStart(2, '0');
    const seconds = String(date.getSeconds()).padStart(2, '0');
    
    return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}